package com.s2sh.action;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.opensymphony.xwork2.ActionContext;
import com.s2sh.po.Items;
import com.s2sh.service.ItemsService;

public class ListAction {
	
//	@Autowired
//	private ItemsService itemsService;

	public String execute(){
		ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext-service.xml");
		ItemsService itemsService = (ItemsService) context.getBean("itemsService");
		
		List<Items> list = itemsService.listItems();
		ActionContext actionContext = ActionContext.getContext();
		
		actionContext.put("list", list);
		
		return "success";
	}
	
}
